<% add_decidim_page_title(import_manifest.message(:title, self)) %>
<div class="item_show__header">
  <h1 class="item_show__header-title">
    <%= import_manifest.message(:title, self) %>

    <div class="flex align-middle gap-x-4 ml-auto">
      <% if import_manifest.has_example? %>
        <div class="relative">
          <button class="button button__sm button__transparent-secondary" data-controller="dropdown" data-target="example-dropdown">
            <%= t(".download_example") %>
            <%= icon "arrow-down-s-line", class: "dropdown-filter-icon" %>
            <%= icon "arrow-down-s-line", class: "dropdown-filter-icon" %>
          </button>
          <ul class="dropdown dropdown__component" id="example-dropdown" aria-hidden="true">
            <% mime_types.each do |format, name| %>
              <li class="dropdown__item">
                <%= link_to admin_imports_example_path(@current_component, name: import_manifest.name, format:), class: "dropdown__button" do %>
                  <%= t(".download_example_format", name:) %>
                <% end %>
              </li>
            <% end %>
          </ul>
        </div>
      <% end %>

      <%= link_to t(".actions.back"), manage_component_path(@current_component), class: "button button__sm button__secondary" %>
    </div>
  </h1>
</div>

<div class="item__edit item__edit-1col">
  <div class="item__edit-form">
    <%= decidim_form_for(@form, url: component_imports_path(name: import_manifest.name), html: { class: "form form-defaults grid-container" }) do |form| %>
      <div class="form__wrapper">
        <div class="card">
          <div class="card-divider"></div>
          <div class="card-section">
            <div class="row column">
              <%= render partial: import_manifest.form_view, locals: { form: } if import_manifest.form_view %>
            </div>

            <div class="row column">
              <fieldset>
                <legend>
                  <%= t(".file_legend", valid_mime_types: mime_types.values.join(", ")).html_safe %>
                  <div class="guidance">
                    <%= import_manifest.message(:help, self).html_safe %>
                  </div>
                </legend>

                <%= form.upload :file, required: true, help_i18n_scope: "decidim.admin.forms.file_help.import", button_class: "button button__sm button__transparent-secondary" %>
              </fieldset>
            </div>
          </div>
        </div>
      </div>
      <div class="item__edit-sticky">
        <div class="item__edit-sticky-container">
          <%= form.submit t(".import"), class: "button button__sm button__secondary" %>
        </div>
      </div>
    <% end -%>
  </div>
</div>
